﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using NetROS.Tiers.Entities;
using NetROS.Tiers.Data;

#endregion

namespace NetROS.Tiers.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="GrupaParametraProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class GrupaParametraProviderBaseCore : EntityProviderBase<NetROS.Tiers.Entities.GrupaParametra, NetROS.Tiers.Entities.GrupaParametraKey>
	{		
		#region Get from Many To Many Relationship Functions
		#region GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra
		
		/// <summary>
		///		Gets tblGrupaParametra objects from the datasource by IDGrupaDjelatnik in the
		///		tblGrupaDjelatnikParametra table. Table tblGrupaParametra is related to table tblGrupaDjelatnik
		///		through the (M:N) relationship defined in the tblGrupaDjelatnikParametra table.
		/// </summary>
		/// <param name="iDGrupaDjelatnik"></param>
		/// <returns>Returns a typed collection of GrupaParametra objects.</returns>
		public TList<GrupaParametra> GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(System.Int32 iDGrupaDjelatnik)
		{
			int count = -1;
			return GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(null,iDGrupaDjelatnik, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets NetROS.Tiers.Entities.GrupaParametra objects from the datasource by IDGrupaDjelatnik in the
		///		tblGrupaDjelatnikParametra table. Table tblGrupaParametra is related to table tblGrupaDjelatnik
		///		through the (M:N) relationship defined in the tblGrupaDjelatnikParametra table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDGrupaDjelatnik"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of GrupaParametra objects.</returns>
		public TList<GrupaParametra> GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(System.Int32 iDGrupaDjelatnik, int start, int pageLength)
		{
			int count = -1;
			return GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(null, iDGrupaDjelatnik, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets GrupaParametra objects from the datasource by IDGrupaDjelatnik in the
		///		tblGrupaDjelatnikParametra table. Table tblGrupaParametra is related to table tblGrupaDjelatnik
		///		through the (M:N) relationship defined in the tblGrupaDjelatnikParametra table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaDjelatnik"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tblGrupaParametra objects.</returns>
		public TList<GrupaParametra> GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(TransactionManager transactionManager, System.Int32 iDGrupaDjelatnik)
		{
			int count = -1;
			return GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(transactionManager, iDGrupaDjelatnik, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets GrupaParametra objects from the datasource by IDGrupaDjelatnik in the
		///		tblGrupaDjelatnikParametra table. Table tblGrupaParametra is related to table tblGrupaDjelatnik
		///		through the (M:N) relationship defined in the tblGrupaDjelatnikParametra table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaDjelatnik"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tblGrupaParametra objects.</returns>
		public TList<GrupaParametra> GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(TransactionManager transactionManager, System.Int32 iDGrupaDjelatnik,int start, int pageLength)
		{
			int count = -1;
			return GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(transactionManager, iDGrupaDjelatnik, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets GrupaParametra objects from the datasource by IDGrupaDjelatnik in the
		///		tblGrupaDjelatnikParametra table. Table tblGrupaParametra is related to table tblGrupaDjelatnik
		///		through the (M:N) relationship defined in the tblGrupaDjelatnikParametra table.
		/// </summary>
		/// <param name="iDGrupaDjelatnik"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tblGrupaParametra objects.</returns>
		public TList<GrupaParametra> GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(System.Int32 iDGrupaDjelatnik,int start, int pageLength, out int count)
		{
			
			return GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(null, iDGrupaDjelatnik, start, pageLength, out count);
		}


		/// <summary>
		///		Gets tblGrupaParametra objects from the datasource by IDGrupaDjelatnik in the
		///		tblGrupaDjelatnikParametra table. Table tblGrupaParametra is related to table tblGrupaDjelatnik
		///		through the (M:N) relationship defined in the tblGrupaDjelatnikParametra table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="iDGrupaDjelatnik"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of GrupaParametra objects.</returns>
		public abstract TList<GrupaParametra> GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra(TransactionManager transactionManager,System.Int32 iDGrupaDjelatnik, int start, int pageLength, out int count);
		
		#endregion GetByIDGrupaDjelatnikFromGrupaDjelatnikParametra
		
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, NetROS.Tiers.Entities.GrupaParametraKey key)
		{
			return Delete(transactionManager, key.IDGrupaParametra);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="iDGrupaParametra">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 iDGrupaParametra)
		{
			return Delete(null, iDGrupaParametra);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaParametra">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 iDGrupaParametra);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override NetROS.Tiers.Entities.GrupaParametra Get(TransactionManager transactionManager, NetROS.Tiers.Entities.GrupaParametraKey key, int start, int pageLength)
		{
			return GetByIDGrupaParametra(transactionManager, key.IDGrupaParametra, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key IX_Unique index.
		/// </summary>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="naziv"></param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametraNaziv(System.Int32 iDGrupaParametra, System.String naziv)
		{
			int count = -1;
			return GetByIDGrupaParametraNaziv(null,iDGrupaParametra, naziv, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Unique index.
		/// </summary>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="naziv"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametraNaziv(System.Int32 iDGrupaParametra, System.String naziv, int start, int pageLength)
		{
			int count = -1;
			return GetByIDGrupaParametraNaziv(null, iDGrupaParametra, naziv, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Unique index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="naziv"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametraNaziv(TransactionManager transactionManager, System.Int32 iDGrupaParametra, System.String naziv)
		{
			int count = -1;
			return GetByIDGrupaParametraNaziv(transactionManager, iDGrupaParametra, naziv, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Unique index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="naziv"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametraNaziv(TransactionManager transactionManager, System.Int32 iDGrupaParametra, System.String naziv, int start, int pageLength)
		{
			int count = -1;
			return GetByIDGrupaParametraNaziv(transactionManager, iDGrupaParametra, naziv, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Unique index.
		/// </summary>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="naziv"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametraNaziv(System.Int32 iDGrupaParametra, System.String naziv, int start, int pageLength, out int count)
		{
			return GetByIDGrupaParametraNaziv(null, iDGrupaParametra, naziv, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Unique index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="naziv"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public abstract NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametraNaziv(TransactionManager transactionManager, System.Int32 iDGrupaParametra, System.String naziv, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_Table_1 index.
		/// </summary>
		/// <param name="iDGrupaParametra"></param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametra(System.Int32 iDGrupaParametra)
		{
			int count = -1;
			return GetByIDGrupaParametra(null,iDGrupaParametra, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Table_1 index.
		/// </summary>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametra(System.Int32 iDGrupaParametra, int start, int pageLength)
		{
			int count = -1;
			return GetByIDGrupaParametra(null, iDGrupaParametra, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Table_1 index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaParametra"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametra(TransactionManager transactionManager, System.Int32 iDGrupaParametra)
		{
			int count = -1;
			return GetByIDGrupaParametra(transactionManager, iDGrupaParametra, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Table_1 index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametra(TransactionManager transactionManager, System.Int32 iDGrupaParametra, int start, int pageLength)
		{
			int count = -1;
			return GetByIDGrupaParametra(transactionManager, iDGrupaParametra, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Table_1 index.
		/// </summary>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametra(System.Int32 iDGrupaParametra, int start, int pageLength, out int count)
		{
			return GetByIDGrupaParametra(null, iDGrupaParametra, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Table_1 index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDGrupaParametra"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> class.</returns>
		public abstract NetROS.Tiers.Entities.GrupaParametra GetByIDGrupaParametra(TransactionManager transactionManager, System.Int32 iDGrupaParametra, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a NetROS.Tiers.Entities.TList&lt;GrupaParametra&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="NetROS.Tiers.Entities.TList&lt;GrupaParametra&gt;"/></returns>
		public static NetROS.Tiers.Entities.TList<GrupaParametra> Fill(IDataReader reader, NetROS.Tiers.Entities.TList<GrupaParametra> rows, int start, int pageLength)
		{
		// advance to the starting row
		for (int i = 0; i < start; i++)
		{
			if (!reader.Read())
			return rows; // not enough rows, just return
		}
		for (int i = 0; i < pageLength; i++)
		{
			if (!reader.Read())
			break; // we are done
			string key = null;
			
			NetROS.Tiers.Entities.GrupaParametra c = null;
			if (DataRepository.Provider.UseEntityFactory)
			{
			key = new System.Text.StringBuilder("GrupaParametra")
			.Append("|").Append((reader.IsDBNull(((int)NetROS.Tiers.Entities.GrupaParametraColumn.IDGrupaParametra - 1))?(int)0:(System.Int32)reader[((int)NetROS.Tiers.Entities.GrupaParametraColumn.IDGrupaParametra - 1)]).ToString()).ToString();
			c = EntityManager.LocateOrCreate<GrupaParametra>(
			key.ToString(), // EntityTrackingKey
			"GrupaParametra",  //Creational Type
			DataRepository.Provider.EntityCreationalFactoryType,  //Factory used to create entity
			DataRepository.Provider.EnableEntityTracking); // Track this entity?
			}
			else
			{
			c = new NetROS.Tiers.Entities.GrupaParametra();
			}
			
			if (!DataRepository.Provider.EnableEntityTracking ||
			c.EntityState == EntityState.Added ||
			(DataRepository.Provider.EnableEntityTracking &&
			((DataRepository.Provider.CurrentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
			(DataRepository.Provider.CurrentLoadPolicy == LoadPolicy.DiscardChanges && (c.EntityState == EntityState.Unchanged ||
								c.EntityState == EntityState.Changed)))))
						{
			c.SuppressEntityEvents = true;
			c.IDGrupaParametra = (System.Int32)reader["IDGrupaParametra"];
			c.OriginalIDGrupaParametra = c.IDGrupaParametra;
			c.Naziv = reader.IsDBNull(reader.GetOrdinal("Naziv")) ? null : (System.String)reader["Naziv"];
			c.EntityTrackingKey = key;
			c.AcceptChanges();
			c.SuppressEntityEvents = false;
			}
			rows.Add(c);
		}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.GrupaParametra"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, NetROS.Tiers.Entities.GrupaParametra entity)
		{
			if (!reader.Read()) return;
			
			entity.IDGrupaParametra = (System.Int32)reader["IDGrupaParametra"];
			entity.OriginalIDGrupaParametra = (System.Int32)reader["IDGrupaParametra"];
			entity.Naziv = reader.IsDBNull(reader.GetOrdinal("Naziv")) ? null : (System.String)reader["Naziv"];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="NetROS.Tiers.Entities.GrupaParametra"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.GrupaParametra"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, NetROS.Tiers.Entities.GrupaParametra entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.IDGrupaParametra = (System.Int32)dataRow["IDGrupaParametra"];
			entity.OriginalIDGrupaParametra = (System.Int32)dataRow["IDGrupaParametra"];
			entity.Naziv = Convert.IsDBNull(dataRow["Naziv"]) ? null : (System.String)dataRow["Naziv"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="NetROS.Tiers.Entities.GrupaParametra"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">NetROS.Tiers.Entities.GrupaParametra Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		internal override void DeepLoad(TransactionManager transactionManager, NetROS.Tiers.Entities.GrupaParametra entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByIDGrupaParametra methods when available
			
			#region GrupaDjelatnikParametraCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<GrupaDjelatnikParametra>|GrupaDjelatnikParametraCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'GrupaDjelatnikParametraCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.GrupaDjelatnikParametraCollection = DataRepository.GrupaDjelatnikParametraProvider.GetByIDGrupaParemetra(transactionManager, entity.IDGrupaParametra);

				if (deep && entity.GrupaDjelatnikParametraCollection.Count > 0)
				{
					deepHandles.Add("GrupaDjelatnikParametraCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<GrupaDjelatnikParametra>) DataRepository.GrupaDjelatnikParametraProvider.DeepLoad,
						new object[] { transactionManager, entity.GrupaDjelatnikParametraCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region GrupaDjelatnikCollection_From_GrupaDjelatnikParametra
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<GrupaDjelatnik>|GrupaDjelatnikCollection_From_GrupaDjelatnikParametra", deepLoadType, innerList))
			{
				entity.GrupaDjelatnikCollection_From_GrupaDjelatnikParametra = DataRepository.GrupaDjelatnikProvider.GetByIDGrupaParemetraFromGrupaDjelatnikParametra(transactionManager, entity.IDGrupaParametra);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'GrupaDjelatnikCollection_From_GrupaDjelatnikParametra' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.GrupaDjelatnikCollection_From_GrupaDjelatnikParametra != null)
				{
					deepHandles.Add("GrupaDjelatnikCollection_From_GrupaDjelatnikParametra",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< GrupaDjelatnik >) DataRepository.GrupaDjelatnikProvider.DeepLoad,
						new object[] { transactionManager, entity.GrupaDjelatnikCollection_From_GrupaDjelatnikParametra, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region ParametriCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Parametri>|ParametriCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'ParametriCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.ParametriCollection = DataRepository.ParametriProvider.GetByIDGrupaParametra(transactionManager, entity.IDGrupaParametra);

				if (deep && entity.ParametriCollection.Count > 0)
				{
					deepHandles.Add("ParametriCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Parametri>) DataRepository.ParametriProvider.DeepLoad,
						new object[] { transactionManager, entity.ParametriCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the NetROS.Tiers.Entities.GrupaParametra object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">NetROS.Tiers.Entities.GrupaParametra instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">NetROS.Tiers.Entities.GrupaParametra Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		internal override bool DeepSave(TransactionManager transactionManager, NetROS.Tiers.Entities.GrupaParametra entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<Delegate, object> deepHandles = new Dictionary<Delegate, object>();

			#region GrupaDjelatnikCollection_From_GrupaDjelatnikParametra>
			if (CanDeepSave(entity.GrupaDjelatnikCollection_From_GrupaDjelatnikParametra, "List<GrupaDjelatnik>|GrupaDjelatnikCollection_From_GrupaDjelatnikParametra", deepSaveType, innerList))
			{
				if (entity.GrupaDjelatnikCollection_From_GrupaDjelatnikParametra.Count > 0 || entity.GrupaDjelatnikCollection_From_GrupaDjelatnikParametra.DeletedItems.Count > 0)
				{
					DataRepository.GrupaDjelatnikProvider.Save(transactionManager, entity.GrupaDjelatnikCollection_From_GrupaDjelatnikParametra); 
					deepHandles.Add(
						(DeepSaveHandle<GrupaDjelatnik>) DataRepository.GrupaDjelatnikProvider.DeepSave,
						new object[] { transactionManager, entity.GrupaDjelatnikCollection_From_GrupaDjelatnikParametra, deepSaveType, childTypes, innerList }
					);
				}
			}
			#endregion 
	
			#region List<GrupaDjelatnikParametra>
				if (CanDeepSave(entity.GrupaDjelatnikParametraCollection, "List<GrupaDjelatnikParametra>|GrupaDjelatnikParametraCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(GrupaDjelatnikParametra child in entity.GrupaDjelatnikParametraCollection)
					{
						if(child.IDGrupaParemetraSource != null)
							child.IDGrupaParemetra = child.IDGrupaParemetraSource.IDGrupaParametra;
						else
							child.IDGrupaParemetra = entity.IDGrupaParametra;

						//Handle right table of GrupaDjelatnikCollection_From_GrupaDjelatnikParametra
						if(child.IDGrupaDjelatnikSource != null)
						{
								child.IDGrupaDjelatnik = child.IDGrupaDjelatnikSource.ID;

						}

						//Handle right table of GrupaDjelatnikCollection_From_GrupaDjelatnikParametra
						if(child.IDGrupaParemetraSource != null)
						{
								child.IDGrupaParemetra = child.IDGrupaParemetraSource.IDGrupaParametra;

						}

					}

					if (entity.GrupaDjelatnikParametraCollection.Count > 0 || entity.GrupaDjelatnikParametraCollection.DeletedItems.Count > 0)
					{
						DataRepository.GrupaDjelatnikParametraProvider.Save(transactionManager, entity.GrupaDjelatnikParametraCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< GrupaDjelatnikParametra >) DataRepository.GrupaDjelatnikParametraProvider.DeepSave,
							new object[] { transactionManager, entity.GrupaDjelatnikParametraCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<Parametri>
				if (CanDeepSave(entity.ParametriCollection, "List<Parametri>|ParametriCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Parametri child in entity.ParametriCollection)
					{
						if(child.IDGrupaParametraSource != null)
							child.IDGrupaParametra = child.IDGrupaParametraSource.IDGrupaParametra;
						else
							child.IDGrupaParametra = entity.IDGrupaParametra;

					}

					if (entity.ParametriCollection.Count > 0 || entity.ParametriCollection.DeletedItems.Count > 0)
					{
						DataRepository.ParametriProvider.Save(transactionManager, entity.ParametriCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< Parametri >) DataRepository.ParametriProvider.DeepSave,
							new object[] { transactionManager, entity.ParametriCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region GrupaParametraChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>NetROS.Tiers.Entities.GrupaParametra</c>
	///</summary>
	public enum GrupaParametraChildEntityTypes
	{

		///<summary>
		/// Collection of <c>GrupaParametra</c> as OneToMany for GrupaDjelatnikParametraCollection
		///</summary>
		[ChildEntityType(typeof(TList<GrupaDjelatnikParametra>))]
		GrupaDjelatnikParametraCollection,

		///<summary>
		/// Collection of <c>GrupaParametra</c> as ManyToMany for GrupaDjelatnikCollection_From_GrupaDjelatnikParametra
		///</summary>
		[ChildEntityType(typeof(TList<GrupaDjelatnik>))]
		GrupaDjelatnikCollection_From_GrupaDjelatnikParametra,

		///<summary>
		/// Collection of <c>GrupaParametra</c> as OneToMany for ParametriCollection
		///</summary>
		[ChildEntityType(typeof(TList<Parametri>))]
		ParametriCollection,
	}
	
	#endregion GrupaParametraChildEntityTypes
	
	#region GrupaParametraFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;GrupaParametraColumn&gt;"/> class
	/// that is used exclusively with a <see cref="GrupaParametra"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class GrupaParametraFilterBuilder : SqlFilterBuilder<GrupaParametraColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the GrupaParametraFilterBuilder class.
		/// </summary>
		public GrupaParametraFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the GrupaParametraFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public GrupaParametraFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the GrupaParametraFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public GrupaParametraFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion GrupaParametraFilterBuilder
	
	#region GrupaParametraParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;GrupaParametraColumn&gt;"/> class
	/// that is used exclusively with a <see cref="GrupaParametra"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class GrupaParametraParameterBuilder : ParameterizedSqlFilterBuilder<GrupaParametraColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the GrupaParametraParameterBuilder class.
		/// </summary>
		public GrupaParametraParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the GrupaParametraParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public GrupaParametraParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the GrupaParametraParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public GrupaParametraParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion GrupaParametraParameterBuilder
} // end namespace
